﻿Namespace UI.Converters
	''' <summary>
	''' Used to embed a value inside a string.
	''' </summary>
	''' <remarks></remarks>
	Public Class ItemToEmbeddedStringConverter
		Implements IValueConverter

		''' <summary>
		''' Takes a value and embeds it into a string.
		''' </summary>
		''' <param name="value">The value to embed in the string.</param>
		''' <param name="parameter">The string to embed the value into. Use the ~ character to mark the location(s) you want the value inserted into.</param>
		''' <returns></returns>
		''' <remarks></remarks>
		Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
			Try
				Return CStr(parameter).Replace("~", CStr(value))
			Catch ex As Exception
				Return value
			End Try
		End Function

		Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
			Throw New NotImplementedException
		End Function
	End Class
End Namespace
